package com.xinyue.gateway.server.handler;

import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

public class LogicMessageHandler  extends ChannelInboundHandlerAdapter {

    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
       //这里可以接收到channel.pipline().fireUserEventTrigged(event)的消息。
        //然后处理消息
        //然后返回消息
        Object msg = null;
        ctx.writeAndFlush(msg);
        
        //根据用户playerId获取它对应的channel
        Channel channel = getChannel(1001);
        //模拟消息
        Object message = "要返回的消息";
        //发送到于玩家的channel
        channel.pipeline().fireUserEventTriggered(message);
    }
    
    public Channel getChannel(int playerId) {
    	return null;
    }
}
